import axios from 'axios';
import _ from 'lodash';

const env = process.env.NODE_ENV;
const request = axios.create({
  baseURL: env === 'development' ? '/api' : 'https://autumnfish.cn',
});

request.interceptors.response.use((ret) => {
  if (!_.isEmpty(ret.data)) {
    return ret.data;
  }
  return ret;
});

export default request;
